#pragma once

#include <string>
#include <unordered_set>
#include <cstdint>

namespace common {

const std::unordered_set<std::string> KEYWORDS = 
{
    "int", "if", "for", "while", 
    "continue", "do", "return", "break"
};

enum WordType 
{
    BEGIN,
    KEYWORD,
    IDENTIFIER,
    CONSTANT,
    OPERATOR,
    SEPARATOR,
    ERROR
};

struct WordToken 
{
    std::string word;
    WordType type;
    WordToken(const std::string &w, WordType t) : word(w), type(t) {};
};

bool IsBlank(char c);
bool IsKey(const std::string &s);
bool IsDigit(char c);
bool IsLetter(char c);
bool IsOperator(char c);
bool IsSeparator(char c);
std::string ReadFromFileAndTrim(const std::string &path);
void Printer(WordType tp, const std::string &s);

// convert two char to uint16_t
uint16_t CharsToUint16(char first, char second);
// revert uint16_t to two char
std::pair<char, char> Uint16ToChars(uint16_t value);

std::string PadColumn(const std::string& content, int width);

} // namespace common